package com.nekoneko.nekonekodemo.ui;

import android.graphics.Canvas;
import android.graphics.Color;
import android.graphics.ColorFilter;
import android.graphics.Path;
import android.graphics.PixelFormat;
import android.graphics.Rect;
import android.graphics.drawable.Drawable;
import android.support.annotation.NonNull;
import android.support.annotation.Nullable;
import android.util.Log;

/**
 * Created by 想法的猫 on 2018/1/5 0005.
 */

public class ShapeDrawable extends Drawable {
    Path path = new Path();

    @Override
    public void draw(@NonNull Canvas canvas) {
        Log.d("ShapeDrawable", "getIntrinsicWidth=" + getIntrinsicWidth());
        canvas.drawColor(Color.WHITE);
        path.moveTo(0, 0);
        path.moveTo(getIntrinsicWidth(), getIntrinsicHeight());
    }

    @Override
    public void setBounds(int left, int top, int right, int bottom) {
        super.setBounds(left, top, right, bottom);
        Log.d("setBounds", "getIntrinsicWidth=" + getIntrinsicWidth());
    }

    @Override
    public void setBounds(@NonNull Rect bounds) {
        super.setBounds(bounds);
        Log.d("setBounds bounds", "getIntrinsicWidth=" + getIntrinsicWidth());
    }

    @Override
    public void setAlpha(int alpha) {

    }

    @Override
    public void setColorFilter(@Nullable ColorFilter colorFilter) {

    }

    @Override
    public int getOpacity() {
        return PixelFormat.OPAQUE;
    }
}
